In [61]:
!pip install folium
import folium
import matplotlib.pyplot as plt 
from sklearn.linear_model import LinearRegression
from sklearn import linear_model
from datetime import datetime 
import requests #get request
import pandas as pd #pandas
import numpy as np #
import sqlite3
import matplotlib.pyplot as plt
import random 
import seaborn as sns
Requirement already satisfied: folium in /opt/conda/lib/python3.8/site-packages (0.11.0)
Requirement already satisfied: jinja2>=2.9 in /opt/conda/lib/python3.8/site-packages (from folium) (2.11.2)
Requirement already satisfied: numpy in /opt/conda/lib/python3.8/site-packages (from folium) (1.19.1)
Requirement already satisfied: requests in /opt/conda/lib/python3.8/site-packages (from folium) (2.24.0)
Requirement already satisfied: branca>=0.3.0 in /opt/conda/lib/python3.8/site-packages (from folium) (0.4.1)
Requirement already satisfied: MarkupSafe>=0.23 in /opt/conda/lib/python3.8/site-packages (from jinja2>=2.9->folium) (1.1.1)
Requirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.8/site-packages (from requests->folium) (2020.6.20)
Requirement already satisfied: chardet<4,>=3.0.2 in /opt/conda/lib/python3.8/site-packages (from requests->folium) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /opt/conda/lib/python3.8/site-packages (from requests->folium) (1.25.10)
Requirement already satisfied: idna<3,>=2.5 in /opt/conda/lib/python3.8/site-packages (from requests->folium) (2.10)
In [62]:
seattleCrime = pd.read_csv("SPD_Crime_Data__2008-Present.csv")
In [63]:
seattleCrime
Out[63]:
Report Number Offense ID Offense Start DateTime Offense End DateTime Report DateTime Group A B Crime Against Category Offense Parent Group Offense Offense Code Precinct Sector Beat MCPP 100 Block Address Longitude Latitude
0 2020-044620 12605873663 2020-02-05 10:10:00 NaN 2020-02-05 11:24:31 A SOCIETY DRUG/NARCOTIC OFFENSES Drug/Narcotic Violations 35A W Q Q1 MAGNOLIA 32XX BLOCK OF 23RD AVE W -122.385974 47.649387
1 2020-044452 12605598696 2020-02-03 08:00:00 2020-02-04 08:00:00 2020-02-05 10:06:28 A PROPERTY LARCENY-THEFT Theft of Motor Vehicle Parts or Accessories 23G N J J3 ROOSEVELT/RAVENNA 63XX BLOCK OF 5TH AVE NE -122.323399 47.675118
2 2020-044465 12605567653 2020-02-02 20:30:00 2020-02-02 21:30:00 2020-02-05 09:39:33 A PROPERTY ROBBERY Robbery 120 N U U3 ROOSEVELT/RAVENNA 26TH AVE NE / NE BLAKELEY ST -122.299552 47.666384
3 2020-044225 12605174036 2020-02-05 01:17:00 2020-02-05 02:21:00 2020-02-05 03:30:55 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property 290 W Q Q1 MAGNOLIA 22XX BLOCK OF W RAYE ST -122.384865 47.642927
4 2020-044121 12605097782 2020-02-04 22:41:00 NaN 2020-02-05 00:59:41 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property 290 S R R1 NORTH BEACON HILL 25XX BLOCK OF 14TH AVE S -122.314719 47.580248
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
874064 2013-247888 7687554356 2013-07-13 01:00:00 NaN 2013-07-13 06:37:00 A PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft 240 SW F F1 PIGEON POINT 41XX BLOCK OF 20TH AVE SW -122.359028 47.565702
874065 2013-227022 7682354808 2013-06-26 11:00:00 2013-06-29 06:30:00 2013-06-29 09:43:00 A PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft 240 W Q Q3 QUEEN ANNE 1ST AVE N / VALLEY ST -122.355386 47.626251
874066 2012-045494 7672915592 2012-02-14 15:04:00 NaN 2012-02-14 15:04:00 A PROPERTY LARCENY-THEFT Shoplifting 23C N U U1 ROOSEVELT/RAVENNA 73XX BLOCK OF ROOSEVELT WAY NE -122.317464 47.681894
874067 2010-328592 7692227482 2010-09-19 16:59:00 NaN 2010-09-19 16:59:00 A PROPERTY LARCENY-THEFT Shoplifting 23C W M M3 DOWNTOWN COMMERCIAL 5XX BLOCK OF PIKE ST -122.335018 47.610909
874068 2010-064656 7686420892 2010-02-25 18:00:00 2010-02-26 07:30:00 2010-02-26 07:54:00 A PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft 240 W Q Q2 QUEEN ANNE 26XX BLOCK OF 1ST AVE N -122.355546 47.643681

874069 rows × 17 columns

In [64]:
(seattleCrime['Crime Against Category']).unique()
Out[64]:
array(['SOCIETY', 'PROPERTY', 'PERSON', 'NOT_A_CRIME'], dtype=object)
In [65]:
(seattleCrime['Offense Parent Group']).unique()
Out[65]:
array(['DRUG/NARCOTIC OFFENSES', 'LARCENY-THEFT', 'ROBBERY',
       'DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY',
       'DRIVING UNDER THE INFLUENCE', 'FRAUD OFFENSES',
       'KIDNAPPING/ABDUCTION', 'COUNTERFEITING/FORGERY',
       'PORNOGRAPHY/OBSCENE MATERIAL', 'EXTORTION/BLACKMAIL',
       'MOTOR VEHICLE THEFT', 'SEX OFFENSES', 'STOLEN PROPERTY OFFENSES',
       'EMBEZZLEMENT', 'WEAPON LAW VIOLATIONS', 'ARSON',
       'HUMAN TRAFFICKING', 'LIQUOR LAW VIOLATIONS', 'BAD CHECKS',
       'PROSTITUTION OFFENSES', 'FAMILY OFFENSES, NONVIOLENT',
       'CURFEW/LOITERING/VAGRANCY VIOLATIONS', 'ANIMAL CRUELTY',
       'HOMICIDE OFFENSES', 'PEEPING TOM', 'SEX OFFENSES, CONSENSUAL',
       'DRUNKENNESS', 'BRIBERY', 'GAMBLING OFFENSES',
       'TRESPASS OF REAL PROPERTY', 'ASSAULT OFFENSES',
       'BURGLARY/BREAKING&ENTERING'], dtype=object)
In [66]:
array_1=[]
array_2=[]
array_3=[]
for x in range(0,3000):
    array_1.append(seattleCrime.loc[x]['Offense Parent Group'])
    array_2.append(seattleCrime.loc[x]['Crime Against Category'])
    array_3.append(seattleCrime.loc[x]['Offense ID'])

plt.scatter(array_2,array_1)
Out[66]:
<matplotlib.collections.PathCollection at 0x7f26f3da6820>
In [67]:
seattleTidy = pd.read_csv("SPD_Crime_Data__2008-Present.csv")
seattleTidy.dropna(inplace=True)
In [68]:
seattleTidy=seattleTidy.drop("Offense End DateTime",axis=1)
seattleTidy=seattleTidy.drop("Offense Code",axis=1)
In [69]:
crimeCounts = sorted(seattleTidy["Offense Parent Group"].unique())
crimeCounts2=[]
temp_df = seattleTidy.copy()
index = 0

for ele in crimeCounts:
    crimeCounts2.append((ele, temp_df.groupby("Offense Parent Group").count()["Offense"][0:].values[index])) 
    index += 1

crimeCounts2 = sorted(crimeCounts2, key=lambda x: x[1], reverse = True)
crimeCounts2[0:10]
Out[69]:
[('LARCENY-THEFT', 220201),
 ('BURGLARY/BREAKING&ENTERING', 62254),
 ('MOTOR VEHICLE THEFT', 45195),
 ('DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY', 42639),
 ('FRAUD OFFENSES', 35439),
 ('ASSAULT OFFENSES', 24189),
 ('TRESPASS OF REAL PROPERTY', 5015),
 ('ROBBERY', 4056),
 ('DRUG/NARCOTIC OFFENSES', 3846),
 ('BAD CHECKS', 2916)]
In [70]:
top_5_crimes = crimeCounts2[0:5]
top_5_crimes
Out[70]:
[('LARCENY-THEFT', 220201),
 ('BURGLARY/BREAKING&ENTERING', 62254),
 ('MOTOR VEHICLE THEFT', 45195),
 ('DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY', 42639),
 ('FRAUD OFFENSES', 35439)]
In [71]:
time_format = "%Y-%m-%d %H:%M:%S"

for idx in seattleTidy.index:
    piInString=str(seattleTidy.at[idx,"Offense Start DateTime"])
    seattleTidy.at[idx,"Offense Start DateTime"] = datetime.strptime(piInString,time_format)
    seattleTidy.at[idx,"Report DateTime"] = datetime.strptime(seattleTidy.at[idx,"Report DateTime"],time_format)

seattleTidy.head()
Out[71]:
Report Number Offense ID Offense Start DateTime Report DateTime Group A B Crime Against Category Offense Parent Group Offense Precinct Sector Beat MCPP 100 Block Address Longitude Latitude
1 2020-044452 12605598696 2020-02-03 08:00:00 2020-02-05 10:06:28 A PROPERTY LARCENY-THEFT Theft of Motor Vehicle Parts or Accessories N J J3 ROOSEVELT/RAVENNA 63XX BLOCK OF 5TH AVE NE -122.323399 47.675118
2 2020-044465 12605567653 2020-02-02 20:30:00 2020-02-05 09:39:33 A PROPERTY ROBBERY Robbery N U U3 ROOSEVELT/RAVENNA 26TH AVE NE / NE BLAKELEY ST -122.299552 47.666384
3 2020-044225 12605174036 2020-02-05 01:17:00 2020-02-05 03:30:55 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property W Q Q1 MAGNOLIA 22XX BLOCK OF W RAYE ST -122.384865 47.642927
7 2020-044104 12605029468 2020-02-04 20:30:00 2020-02-04 23:31:52 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property N J J3 PHINNEY RIDGE 71XX BLOCK OF GREENWOOD AVE N -122.355309 47.680527
9 2020-044013 12605015456 2020-02-04 20:20:00 2020-02-04 22:28:09 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property N U U1 SANDPOINT RAVENNA AVE NE / NE 95TH ST -122.304891 47.697564
In [72]:
crimes = {}

for i in range(len(top_5_crimes)):
    crimes[top_5_crimes[i][0]] = [] 

for idx in seattleTidy.index: 
    
    t = seattleTidy.at[idx,"Offense Parent Group"]

    if t in crimes: #IF ITS A TOP CRIME TYPE
        hour = seattleTidy.at[idx, "Offense Start DateTime"].hour 
        crimes[t].append(hour)   

for i in crimes:      
    hist, bin_edges = np.histogram(crimes[i], bins=24)
    plt.hist(crimes[i],bins=24,color="red",edgecolor='black', linewidth=1.2)
    plt.ylabel("Frequency of " + i)
    plt.xlabel("Hour of Day")
    plt.title(i + " happenings per Hour")
    plt.show()
In [73]:
seattleTidy['SEASON OF OCCURENCE'] = None


for idx in seattleTidy.index:
    curr_month = seattleTidy.at[idx, "Offense Start DateTime"].month
    
    if curr_month == 12 or (1 <= curr_month and curr_month <= 2):
        seattleTidy.at[idx,'SEASON OF OCCURENCE'] = "Winter"
    elif 3 <= curr_month and curr_month <= 5:
        seattleTidy.at[idx,'SEASON OF OCCURENCE'] = "Spring"
    elif 6 <= curr_month and curr_month <= 8:
        seattleTidy.at[idx,'SEASON OF OCCURENCE'] = "Summer"
    elif 9 <= curr_month and curr_month <= 11:
        seattleTidy.at[idx,'SEASON OF OCCURENCE'] = "Fall"

seattleTidy.head()
Out[73]:
Report Number Offense ID Offense Start DateTime Report DateTime Group A B Crime Against Category Offense Parent Group Offense Precinct Sector Beat MCPP 100 Block Address Longitude Latitude SEASON OF OCCURENCE
1 2020-044452 12605598696 2020-02-03 08:00:00 2020-02-05 10:06:28 A PROPERTY LARCENY-THEFT Theft of Motor Vehicle Parts or Accessories N J J3 ROOSEVELT/RAVENNA 63XX BLOCK OF 5TH AVE NE -122.323399 47.675118 Winter
2 2020-044465 12605567653 2020-02-02 20:30:00 2020-02-05 09:39:33 A PROPERTY ROBBERY Robbery N U U3 ROOSEVELT/RAVENNA 26TH AVE NE / NE BLAKELEY ST -122.299552 47.666384 Winter
3 2020-044225 12605174036 2020-02-05 01:17:00 2020-02-05 03:30:55 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property W Q Q1 MAGNOLIA 22XX BLOCK OF W RAYE ST -122.384865 47.642927 Winter
7 2020-044104 12605029468 2020-02-04 20:30:00 2020-02-04 23:31:52 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property N J J3 PHINNEY RIDGE 71XX BLOCK OF GREENWOOD AVE N -122.355309 47.680527 Winter
9 2020-044013 12605015456 2020-02-04 20:20:00 2020-02-04 22:28:09 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property N U U1 SANDPOINT RAVENNA AVE NE / NE 95TH ST -122.304891 47.697564 Winter
In [74]:
seattleTidy['Year Start'] = None


for idx in seattleTidy.index:
    curr_year = seattleTidy.at[idx, "Offense Start DateTime"].year
    
    seattleTidy.at[idx,'Year Start'] = curr_year
In [75]:
seattleTidy.head()
Out[75]:
Report Number Offense ID Offense Start DateTime Report DateTime Group A B Crime Against Category Offense Parent Group Offense Precinct Sector Beat MCPP 100 Block Address Longitude Latitude SEASON OF OCCURENCE Year Start
1 2020-044452 12605598696 2020-02-03 08:00:00 2020-02-05 10:06:28 A PROPERTY LARCENY-THEFT Theft of Motor Vehicle Parts or Accessories N J J3 ROOSEVELT/RAVENNA 63XX BLOCK OF 5TH AVE NE -122.323399 47.675118 Winter 2020
2 2020-044465 12605567653 2020-02-02 20:30:00 2020-02-05 09:39:33 A PROPERTY ROBBERY Robbery N U U3 ROOSEVELT/RAVENNA 26TH AVE NE / NE BLAKELEY ST -122.299552 47.666384 Winter 2020
3 2020-044225 12605174036 2020-02-05 01:17:00 2020-02-05 03:30:55 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property W Q Q1 MAGNOLIA 22XX BLOCK OF W RAYE ST -122.384865 47.642927 Winter 2020
7 2020-044104 12605029468 2020-02-04 20:30:00 2020-02-04 23:31:52 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property N J J3 PHINNEY RIDGE 71XX BLOCK OF GREENWOOD AVE N -122.355309 47.680527 Winter 2020
9 2020-044013 12605015456 2020-02-04 20:20:00 2020-02-04 22:28:09 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property N U U1 SANDPOINT RAVENNA AVE NE / NE 95TH ST -122.304891 47.697564 Winter 2020
In [76]:
crimes2 = {}

for i in range(len(top_5_crimes)):
    crimes2[top_5_crimes[i][0]] = [] 

for idx in seattleTidy.index: 
    
    t = seattleTidy.at[idx,"Offense Parent Group"]

    if t in crimes2: #IF ITS A TOP CRIME TYPE
        year = seattleTidy.at[idx, "Offense Start DateTime"].year
        crimes2[t].append(year)        

for i in crimes2:      
    hist, bin_edges = np.histogram(crimes2[i], bins=24)

    plt.hist(crimes2[i],bins=24,color="green",edgecolor='black', linewidth=1.2)
    plt.ylabel("Frequency of " + i)
    plt.xlabel("Year")
    plt.title(i + " happenings per Year")
    plt.show()
In [114]:
#season_list = [['Winter'], ['Spring'], ['Summer'], ['Fall']]
 
#NEW HASH FOR TOP_5_CRIMES (JUST NAMES->NOT TUPLES)
#top_5_crimes_histo = []

#for i in top_5_crimes:
  #  top_5_crimes_histo.append(i[0])


#HASH FOR THE TYPES->SEASONS-> HOURS
#crimes_seasons_hours = {}

#for i in top_5_crimes_histo:
 #   crimes_seasons_hours[i] = {"Winter":[], "Spring":[], "Summer":[], "Fall":[]}
    
#FOR EACH SEASON, CHECK IF THE ROWS IN THE DATAFRAME HAVE A CERTAIN TYPE AND ADD THEIR HOURS ACCORDINGLY TO OUR HASH
#for season in season_list:
  #  for index,row in seattleTidy[seattleTidy["SEASON OF OCCURENCE"].isin(season)].iterrows():
     #   t = row['Offense Parent Group']
      #  if t in top_5_crimes_histo:
       #     crimes_seasons_hours[t][season[0]].append(row['Offense Start DateTime'].hour)
In [78]:
#crimes_seasons_hours
In [79]:
seattleTidy
Out[79]:
Report Number Offense ID Offense Start DateTime Report DateTime Group A B Crime Against Category Offense Parent Group Offense Precinct Sector Beat MCPP 100 Block Address Longitude Latitude SEASON OF OCCURENCE Year Start
1 2020-044452 12605598696 2020-02-03 08:00:00 2020-02-05 10:06:28 A PROPERTY LARCENY-THEFT Theft of Motor Vehicle Parts or Accessories N J J3 ROOSEVELT/RAVENNA 63XX BLOCK OF 5TH AVE NE -122.323399 47.675118 Winter 2020
2 2020-044465 12605567653 2020-02-02 20:30:00 2020-02-05 09:39:33 A PROPERTY ROBBERY Robbery N U U3 ROOSEVELT/RAVENNA 26TH AVE NE / NE BLAKELEY ST -122.299552 47.666384 Winter 2020
3 2020-044225 12605174036 2020-02-05 01:17:00 2020-02-05 03:30:55 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property W Q Q1 MAGNOLIA 22XX BLOCK OF W RAYE ST -122.384865 47.642927 Winter 2020
7 2020-044104 12605029468 2020-02-04 20:30:00 2020-02-04 23:31:52 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property N J J3 PHINNEY RIDGE 71XX BLOCK OF GREENWOOD AVE N -122.355309 47.680527 Winter 2020
9 2020-044013 12605015456 2020-02-04 20:20:00 2020-02-04 22:28:09 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property N U U1 SANDPOINT RAVENNA AVE NE / NE 95TH ST -122.304891 47.697564 Winter 2020
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
874055 2020-307192 16779563026 2020-10-30 02:00:00 2020-10-30 09:59:22 A PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft N N N2 BITTERLAKE 140XX BLOCK OF LINDEN AVE N -122.347755 47.730317 Fall 2020
874061 2019-223685 8335129478 2019-04-01 11:52:58 2019-06-19 13:50:53 A PROPERTY BURGLARY/BREAKING&ENTERING Burglary/Breaking & Entering W D D3 SLU/CASCADE 12XX BLOCK OF HARRISON ST -122.331070 47.621970 Spring 2019
874063 2014-122134 7699116275 2014-03-20 10:30:00 2014-04-21 15:02:00 A PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft W D D2 QUEEN ANNE 27XX BLOCK OF WESTLAKE AVE N -122.347302 47.645030 Spring 2014
874065 2013-227022 7682354808 2013-06-26 11:00:00 2013-06-29 09:43:00 A PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft W Q Q3 QUEEN ANNE 1ST AVE N / VALLEY ST -122.355386 47.626251 Summer 2013
874068 2010-064656 7686420892 2010-02-25 18:00:00 2010-02-26 07:54:00 A PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft W Q Q2 QUEEN ANNE 26XX BLOCK OF 1ST AVE N -122.355546 47.643681 Winter 2010

454360 rows × 17 columns

In [80]:
crimeSeason = sorted(seattleTidy["SEASON OF OCCURENCE"].unique())
crimeSeason2=[]
tempSeason_df = seattleTidy.copy()
index = 0

for ele in crimeSeason:
    crimeSeason2.append((ele, tempSeason_df.groupby("SEASON OF OCCURENCE").count()["Offense"][0:].values[index])) 
    index += 1

#crimeSeason2 = sorted(crimeSeason2, key=lambda x: x[1], reverse = True)
crimeSeason2

    
Out[80]:
[('Fall', 116834), ('Spring', 117270), ('Summer', 114119), ('Winter', 106137)]
In [81]:
def swapList(newList): 
    size = len(newList) 
      
    # Swapping  
    temp = newList[0] 
    newList[0] = newList[size - 1] 
    newList[size - 1] = temp 
      
    return newList 
In [82]:
lis=crimeSeason2
lis[0], lis[-1] = lis[-1], lis[0]
lis
#re order the list of seasons with number of crimes committed to correct order 
Out[82]:
[('Winter', 106137), ('Spring', 117270), ('Summer', 114119), ('Fall', 116834)]
In [83]:
crimeSeason2Copy=lis

graphOfSeasons = [(elem1, elem2) for elem1, elem2 in crimeSeason2Copy]
for (a,b) in graphOfSeasons:

    b=b.item()
    print(type(a),type(b))
<class 'str'> <class 'int'>
<class 'str'> <class 'int'>
<class 'str'> <class 'int'>
<class 'str'> <class 'int'>
In [84]:
fig = plt.figure()
ax = fig.add_axes([0,0,1,1])
langs = ['Winter', 'Spring', 'Summer', 'Fall']
students = [106137,117270,114119,116834]
ax.bar(langs,students)
plt.title("Crimes Committed Per Season From 2020 to 2008") 
plt.xlabel("Season")
plt.ylabel("Number of Crimes Committed")
plt.show()
In [113]:
plt.figure(figsize=(20,10))
plt.plot(*zip(*crimeSeason2Copy))
plt.title("Crimes Committed Per Season From 2008 to 2020") 
plt.xlabel("Season")
plt.ylabel("Number of Crimes Committed")
plt.show()
In [86]:
#for cri in crimes_seasons_hours: #FOR EACH CRIME
    #multi_x = []
    #legend_season_list = []
    #weights =[]
    
    #for season in crimes_seasons_hours[cri]: #4 SEASONS FOR EACH CRIME
        #legend_season_list.append(season)
       # multi_x.append(crimes_seasons_hours[cri][season]) #years FOR THE CRIME
       # weights.append(np.ones_like(crimes_seasons_hours[cri][season])/float(len(crimes_seasons_hours[cri][season])))
   # plt.figure(figsize=(16,6))
   # plt.hist(multi_x,10,histtype = "bar",weights=weights, label=legend_season_list) #PLOT THE DATA

    #plt.title(cri + " Occurances per Year") #LABELS
    #plt.xlabel("Years " )
    #plt.ylabel("Percentage of " + cri)
    
   # plt.legend()
   # plt.show()
   
 #('LARCENY-THEFT', 220201),('BURGLARY/BREAKING&ENTERING', 62254) ('MOTOR VEHICLE THEFT', 45195), ('DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY', 42639), ('FRAUD OFFENSES', 35439)]
In [87]:
crime_copy=top_5_crimes
In [88]:
testList2 = [(elem1, elem2) for elem1, elem2 in crime_copy]
for (t,w) in testList2:

    w=w.item()
    print(type(t),type(w))
<class 'str'> <class 'int'>
<class 'str'> <class 'int'>
<class 'str'> <class 'int'>
<class 'str'> <class 'int'>
<class 'str'> <class 'int'>
In [89]:
#plt.figure(figsize=(20,10))
fig2 = plt.figure(figsize=(20,10))
ax2 = fig2.add_axes([0,0,1,1])
TypeParentOffenseGroup = ['LARCENY-THEFT', 'BURGLARY/BREAKING & ENTERING', 'MOTOR VEHICLE THEFT', 'DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY','FRAUD OFFENSES']
numC = [220201,62254,45195,42639,35439]
ax2.bar(TypeParentOffenseGroup,numC)
plt.title("Crimes Committed for Top 5 Offense Parent Groups") 
plt.xlabel("Offense Parent Group")
plt.ylabel("Number of Crimes Committed")
plt.show()
In [90]:
plt.figure(figsize=(20,10))
plt.plot(*zip(*testList2))
plt.title("Crimes Committed in Each Parent Offense Group") 
plt.xlabel("Offense Parent Group")
plt.ylabel("Number of Crimes Committed")
plt.show()
In [91]:
a=seattleTidy['Offense']
a
Out[91]:
1         Theft of Motor Vehicle Parts or Accessories
2                                             Robbery
3            Destruction/Damage/Vandalism of Property
7            Destruction/Damage/Vandalism of Property
9            Destruction/Damage/Vandalism of Property
                             ...                     
874055                            Motor Vehicle Theft
874061                   Burglary/Breaking & Entering
874063                            Motor Vehicle Theft
874065                            Motor Vehicle Theft
874068                            Motor Vehicle Theft
Name: Offense, Length: 454360, dtype: object
In [92]:
crimewCounts = sorted(seattleTidy["Offense"].unique())
crimewCounts2=[]
tempw_df = seattleCrime.copy()
index = 0

for ele in crimewCounts:
    crimewCounts2.append((ele, tempw_df.groupby("Offense").count()["Offense Parent Group"][0:].values[index])) 
    index += 1

crimewCounts2 = sorted(crimewCounts2, key=lambda x: x[1], reverse = True)
crimewCounts2[0:10]
Out[92]:
[('Burglary/Breaking & Entering', 95733),
 ('Destruction/Damage/Vandalism of Property', 79975),
 ('All Other Larceny', 73614),
 ('Robbery', 52191),
 ('Pornography/Obscene Material', 28505),
 ('Aggravated Assault', 27413),
 ('Drug/Narcotic Violations', 22852),
 ('Wire Fraud', 20223),
 ('Credit Card/Automated Teller Machine Fraud', 17723),
 ('Driving Under the Influence', 15813)]
In [93]:
top5Offenses=crimewCounts2[0:5]
In [94]:
top5Offenses
Out[94]:
[('Burglary/Breaking & Entering', 95733),
 ('Destruction/Damage/Vandalism of Property', 79975),
 ('All Other Larceny', 73614),
 ('Robbery', 52191),
 ('Pornography/Obscene Material', 28505)]
In [95]:
heatMapCSV=seattleTidy
heatMapCSV.dropna(inplace=True)
heatMapCSV
Out[95]:
Report Number Offense ID Offense Start DateTime Report DateTime Group A B Crime Against Category Offense Parent Group Offense Precinct Sector Beat MCPP 100 Block Address Longitude Latitude SEASON OF OCCURENCE Year Start
1 2020-044452 12605598696 2020-02-03 08:00:00 2020-02-05 10:06:28 A PROPERTY LARCENY-THEFT Theft of Motor Vehicle Parts or Accessories N J J3 ROOSEVELT/RAVENNA 63XX BLOCK OF 5TH AVE NE -122.323399 47.675118 Winter 2020
2 2020-044465 12605567653 2020-02-02 20:30:00 2020-02-05 09:39:33 A PROPERTY ROBBERY Robbery N U U3 ROOSEVELT/RAVENNA 26TH AVE NE / NE BLAKELEY ST -122.299552 47.666384 Winter 2020
3 2020-044225 12605174036 2020-02-05 01:17:00 2020-02-05 03:30:55 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property W Q Q1 MAGNOLIA 22XX BLOCK OF W RAYE ST -122.384865 47.642927 Winter 2020
7 2020-044104 12605029468 2020-02-04 20:30:00 2020-02-04 23:31:52 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property N J J3 PHINNEY RIDGE 71XX BLOCK OF GREENWOOD AVE N -122.355309 47.680527 Winter 2020
9 2020-044013 12605015456 2020-02-04 20:20:00 2020-02-04 22:28:09 A PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property N U U1 SANDPOINT RAVENNA AVE NE / NE 95TH ST -122.304891 47.697564 Winter 2020
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
874055 2020-307192 16779563026 2020-10-30 02:00:00 2020-10-30 09:59:22 A PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft N N N2 BITTERLAKE 140XX BLOCK OF LINDEN AVE N -122.347755 47.730317 Fall 2020
874061 2019-223685 8335129478 2019-04-01 11:52:58 2019-06-19 13:50:53 A PROPERTY BURGLARY/BREAKING&ENTERING Burglary/Breaking & Entering W D D3 SLU/CASCADE 12XX BLOCK OF HARRISON ST -122.331070 47.621970 Spring 2019
874063 2014-122134 7699116275 2014-03-20 10:30:00 2014-04-21 15:02:00 A PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft W D D2 QUEEN ANNE 27XX BLOCK OF WESTLAKE AVE N -122.347302 47.645030 Spring 2014
874065 2013-227022 7682354808 2013-06-26 11:00:00 2013-06-29 09:43:00 A PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft W Q Q3 QUEEN ANNE 1ST AVE N / VALLEY ST -122.355386 47.626251 Summer 2013
874068 2010-064656 7686420892 2010-02-25 18:00:00 2010-02-26 07:54:00 A PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft W Q Q2 QUEEN ANNE 26XX BLOCK OF 1ST AVE N -122.355546 47.643681 Winter 2010

454360 rows × 17 columns

In [96]:
heatMapCSV=heatMapCSV.drop("Group A B",axis=1)
heatMapCSV=heatMapCSV.drop("Precinct",axis=1)
heatMapCSV=heatMapCSV.drop("Sector",axis=1)
heatMapCSV=heatMapCSV.drop("Beat",axis=1)
heatMapCSV=heatMapCSV.drop("MCPP",axis=1)
heatMapCSV=heatMapCSV.drop("Report DateTime",axis=1)
heatMapCSV=heatMapCSV.drop("Offense ID",axis=1) 
heatMapCSV=heatMapCSV.drop("100 Block Address",axis=1)
heatMapCSV=heatMapCSV.drop("SEASON OF OCCURENCE",axis=1)
#heatMapCSV=heatMapCSV.drop("Year Start",axis=1)
heatMapCSV=heatMapCSV.drop("Report Number",axis=1)
#heatMapCSV=heatMapCSV.drop("Longitude",axis=1)
#heatMapCSV=heatMapCSV.drop("Latitude",axis=1)
#heatMapCSV=heatMapCSV.drop("Crime Against Category",axis=1)
#heatMapCSV=heatMapCSV.drop("Offense Parent Group",axis=1)
heatMapCSV.reset_index()
heatMapCSV
Out[96]:
Offense Start DateTime Crime Against Category Offense Parent Group Offense Longitude Latitude Year Start
1 2020-02-03 08:00:00 PROPERTY LARCENY-THEFT Theft of Motor Vehicle Parts or Accessories -122.323399 47.675118 2020
2 2020-02-02 20:30:00 PROPERTY ROBBERY Robbery -122.299552 47.666384 2020
3 2020-02-05 01:17:00 PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property -122.384865 47.642927 2020
7 2020-02-04 20:30:00 PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property -122.355309 47.680527 2020
9 2020-02-04 20:20:00 PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property -122.304891 47.697564 2020
... ... ... ... ... ... ... ...
874055 2020-10-30 02:00:00 PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft -122.347755 47.730317 2020
874061 2019-04-01 11:52:58 PROPERTY BURGLARY/BREAKING&ENTERING Burglary/Breaking & Entering -122.331070 47.621970 2019
874063 2014-03-20 10:30:00 PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft -122.347302 47.645030 2014
874065 2013-06-26 11:00:00 PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft -122.355386 47.626251 2013
874068 2010-02-25 18:00:00 PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft -122.355546 47.643681 2010

454360 rows × 7 columns

In [97]:
heatMapCSV['Month of OCCURENCE'] = None


for idx in heatMapCSV.index:
    curr_month = heatMapCSV.at[idx, "Offense Start DateTime"].month
 
    if curr_month == 12:
        heatMapCSV.at[idx,'Month of OCCURENCE'] = "December"
    
    elif curr_month == 11:
        heatMapCSV.at[idx,'Month of OCCURENCE'] = "November"
    
    elif curr_month == 10:
        heatMapCSV.at[idx,'Month of OCCURENCE'] = "October"
    
    elif curr_month == 9:
        heatMapCSV.at[idx,'Month of OCCURENCE'] = "September"
    
    elif curr_month == 8:        
        heatMapCSV.at[idx,'Month of OCCURENCE'] = "August"
    
    elif curr_month == 7:
        heatMapCSV.at[idx,'Month of OCCURENCE'] = "July"
   
    elif curr_month == 6:
        heatMapCSV.at[idx,'Month of OCCURENCE'] = "June"
    elif curr_month == 5:
        heatMapCSV.at[idx,'Month of OCCURENCE'] = "May"
    elif curr_month == 4:
        heatMapCSV.at[idx,'Month of OCCURENCE'] = "April"
    elif curr_month == 3:
        heatMapCSV.at[idx,'Month of OCCURENCE'] = "March"
    elif curr_month == 2:
        heatMapCSV.at[idx,'Month of OCCURENCE'] = "February"
    elif curr_month == 1:
        heatMapCSV.at[idx,'Month of OCCURENCE'] = "January"

heatMapCSV.head()
   
Out[97]:
Offense Start DateTime Crime Against Category Offense Parent Group Offense Longitude Latitude Year Start Month of OCCURENCE
1 2020-02-03 08:00:00 PROPERTY LARCENY-THEFT Theft of Motor Vehicle Parts or Accessories -122.323399 47.675118 2020 February
2 2020-02-02 20:30:00 PROPERTY ROBBERY Robbery -122.299552 47.666384 2020 February
3 2020-02-05 01:17:00 PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property -122.384865 47.642927 2020 February
7 2020-02-04 20:30:00 PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property -122.355309 47.680527 2020 February
9 2020-02-04 20:20:00 PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property -122.304891 47.697564 2020 February
In [98]:
heatPlot=heatMapCSV
heatPlot=heatPlot.drop("Offense Start DateTime",axis=1)
heatPlot
Out[98]:
Crime Against Category Offense Parent Group Offense Longitude Latitude Year Start Month of OCCURENCE
1 PROPERTY LARCENY-THEFT Theft of Motor Vehicle Parts or Accessories -122.323399 47.675118 2020 February
2 PROPERTY ROBBERY Robbery -122.299552 47.666384 2020 February
3 PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property -122.384865 47.642927 2020 February
7 PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property -122.355309 47.680527 2020 February
9 PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property -122.304891 47.697564 2020 February
... ... ... ... ... ... ... ...
874055 PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft -122.347755 47.730317 2020 October
874061 PROPERTY BURGLARY/BREAKING&ENTERING Burglary/Breaking & Entering -122.331070 47.621970 2019 April
874063 PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft -122.347302 47.645030 2014 March
874065 PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft -122.355386 47.626251 2013 June
874068 PROPERTY MOTOR VEHICLE THEFT Motor Vehicle Theft -122.355546 47.643681 2010 February

454360 rows × 7 columns

In [115]:
map_model = folium.Map(location=[47.6062, -122.331], zoom_start=11)
map_model
Out[115]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [101]:
map_parentGroup=folium.Map(location=[47.6062, -122.331], zoom_start=11)
map_parentGroup
Out[101]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [102]:
map_crimeAgainst=folium.Map(location=[47.6062, -122.331], zoom_start=11)
map_crimeAgainst
Out[102]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [103]:
locationsCrime = heatMapCSV[['Latitude', 'Longitude']]
locationsCrime
Out[103]:
Latitude Longitude
1 47.675118 -122.323399
2 47.666384 -122.299552
3 47.642927 -122.384865
7 47.680527 -122.355309
9 47.697564 -122.304891
... ... ...
874055 47.730317 -122.347755
874061 47.621970 -122.331070
874063 47.645030 -122.347302
874065 47.626251 -122.355386
874068 47.643681 -122.355546

454360 rows × 2 columns

In [104]:
locationsCrimeList=locationsCrime.values.tolist()
locationsCrimeList
Out[104]:
[[47.67511789, -122.323399063],
 [47.66638407, -122.29955218],
 [47.64292734, -122.384864805],
 [47.68052695, -122.355309065],
 [47.69756434, -122.30489081],
 [47.61468385, -122.316845012],
 [47.66247336, -122.32072010600001],
 [47.5859559, -122.315976829],
 [47.61932364, -122.320863694],
 [47.54294056, -122.32290903200001],
 [47.62394954, -122.361938917],
 [47.57140627, -122.33200668399999],
 [47.70233163, -122.33452432],
 [47.61859552, -122.353751129],
 [47.630894399999995, -122.36180477399999],
 [47.61221899, -122.308863594],
 [47.61221899, -122.308863594],
 [47.71354798, -122.34483426799999],
 [47.55638651, -122.314783435],
 [47.57999734, -122.30489459799999],
 [47.66218058, -122.313115709],
 [47.60709807, -122.30893628],
 [47.57876794, -122.329988664],
 [47.60512615, -122.33049384200001],
 [47.65912603, -122.34563939],
 [47.51654951, -122.378095285],
 [47.58323011, -122.383821146],
 [47.60291195, -122.334607817],
 [47.60169935, -122.320159539],
 [47.66007201, -122.34562812],
 [47.67889074, -122.26222809299999],
 [47.66365981, -122.37218016],
 [47.61018167, -122.33511980200001],
 [47.72503555, -122.34499682799999],
 [47.72503555, -122.34499682799999],
 [47.65137209, -122.38755847600001],
 [47.7086028, -122.32461515799999],
 [47.59750785, -122.322052376],
 [47.70400593, -122.316877599],
 [47.61704694, -122.324495896],
 [47.58435803, -122.299022274],
 [47.60960404, -122.32922111],
 [47.54195105, -122.376509787],
 [47.70599117, -122.35545968299999],
 [47.66365981, -122.37218016],
 [47.60047410000001, -122.33287805299999],
 [47.616134100000004, -122.350186371],
 [47.52193839, -122.364542433],
 [47.5165395, -122.28512018],
 [47.63595428, -122.366339921],
 [47.62460516, -122.362586854],
 [47.66329603, -122.368605586],
 [47.61764399, -122.303753445],
 [47.61597109, -122.352887455],
 [47.51258367, -122.26472355899999],
 [47.64217288, -122.398309451],
 [47.5360414, -122.36129766200001],
 [47.61588661, -122.337879034],
 [47.61393023, -122.327804574],
 [47.60218964, -122.316781855],
 [47.62107587, -122.32089167299999],
 [47.59709367, -122.325063697],
 [47.55200342, -122.379318965],
 [47.55200342, -122.379318965],
 [47.62454524, -122.336479326],
 [47.57019913, -122.280730889],
 [47.61090902, -122.33501787600001],
 [47.60241242, -122.331082199],
 [47.57927478, -122.377542525],
 [47.65046915, -122.35448367],
 [47.5992282, -122.310924822],
 [47.60872352, -122.340630935],
 [47.59678343, -122.333268209],
 [47.61236106, -122.317913914],
 [47.64650426, -122.32519843799999],
 [47.65001037, -122.34979117299999],
 [47.7086028, -122.32461515799999],
 [47.66867356, -122.388860707],
 [47.59076389, -122.317280369],
 [47.62758727, -122.344937685],
 [47.5985085, -122.286922048],
 [47.71354798, -122.34483426799999],
 [47.71354798, -122.34483426799999],
 [47.61264032, -122.324320572],
 [47.62500382, -122.351483825],
 [47.60882096, -122.34001342200001],
 [47.65982286, -122.31548087200001],
 [47.56935997, -122.392108224],
 [47.60951744, -122.338348304],
 [47.69906761, -122.341927731],
 [47.68253569, -122.300744931],
 [47.65980204, -122.31374637399999],
 [47.66221425, -122.31840882200001],
 [47.72323367, -122.35554670799999],
 [47.66595739, -122.382666321],
 [47.61097516, -122.338146742],
 [47.61730887, -122.35316864],
 [47.67032171, -122.290822445],
 [47.61730887, -122.35316864],
 [47.56558373, -122.377447628],
 [47.56473744, -122.3874491],
 [47.61669063, -122.346170622],
 [47.56742553, -122.37744548799999],
 [47.61588924, -122.300082009],
 [47.66129873, -122.31763816200001],
 [47.61523114, -122.323415475],
 [47.61628073, -122.33357712700001],
 [47.64254854, -122.35555354],
 [47.54761638, -122.334314673],
 [47.68592294, -122.32697455],
 [47.65912662, -122.34669439700001],
 [47.72323212, -122.354866194],
 [47.64650426, -122.32519843799999],
 [47.57215315, -122.37709168200001],
 [47.63239628, -122.28268729],
 [47.66292138, -122.365097046],
 [47.62586164, -122.363883734],
 [47.65832864, -122.314363316],
 [47.6158847, -122.33294187],
 [47.65604983, -122.35446663],
 [47.592553499999994, -122.306241505],
 [47.54098986, -122.354956677],
 [47.57291861, -122.294005649],
 [47.59748648, -122.31027812299999],
 [47.51343904, -122.252409725],
 [47.66867758, -122.38392862100001],
 [47.61090902, -122.33501787600001],
 [47.55484507, -122.266994952],
 [47.58501972, -122.303257158],
 [47.56811919, -122.313450994],
 [47.62370445, -122.32304886899999],
 [47.66138576, -122.33568334799999],
 [47.65849092, -122.320841552],
 [47.67539722, -122.315657945],
 [47.70858578, -122.321918379],
 [47.64777379, -122.35609156299999],
 [47.59857935, -122.302231478],
 [47.61927445, -122.32482906899999],
 [47.62673542, -122.36191479600001],
 [47.62673542, -122.36191479600001],
 [47.68674595, -122.318902466],
 [47.58197915, -122.30818118200001],
 [47.61873646, -122.32152064600001],
 [47.61097885, -122.316779126],
 [47.56385064, -122.38812762799999],
 [47.65916004, -122.288760522],
 [47.69781254, -122.34595549999999],
 [47.63292033, -122.36762984200001],
 [47.61790609, -122.352191366],
 [47.66138572, -122.33990953200001],
 [47.614577600000004, -122.327915389],
 [47.56951609, -122.31359716899999],
 [47.61522861, -122.322772701],
 [47.66338968, -122.37964207700001],
 [47.65462125, -122.32789108799999],
 [47.6258506, -122.36126704200001],
 [47.64074809, -122.35398105],
 [47.6477706, -122.35390970799999],
 [47.69326938, -122.34240219700001],
 [47.67729636, -122.318739014],
 [47.61836608, -122.352969299],
 [47.66701275, -122.40931229799999],
 [47.5191963, -122.356811165],
 [47.6718745, -122.35771846899999],
 [47.61264032, -122.324320572],
 [47.61730887, -122.35316864],
 [47.68413737, -122.37786007],
 [47.56347818, -122.362400992],
 [47.60736381, -122.34021613899999],
 [47.61628073, -122.33357712700001],
 [47.70858578, -122.321918379],
 [47.67669047, -122.29165379],
 [47.61605329, -122.336165507],
 [47.61991247, -122.32020609799999],
 [47.71951899, -122.328232531],
 [47.72867309, -122.343009348],
 [47.54977227, -122.288887697],
 [47.54328358, -122.396531383],
 [47.61064592, -122.33401037799999],
 [47.66332336, -122.298411155],
 [47.60865749, -122.32075579299999],
 [47.60925299, -122.33733875],
 [47.60925299, -122.33733875],
 [47.52102254, -122.365221006],
 [47.54566315, -122.283336908],
 [47.61132124, -122.337320423],
 [47.65123952, -122.384674317],
 [47.63103937, -122.391970804],
 [47.54970394, -122.277134581],
 [47.61581931, -122.32080789700001],
 [47.620491799999996, -122.320882286],
 [47.65046915, -122.35448367],
 [47.61210339, -122.333808099],
 [47.58025306, -122.31602335],
 [47.6067848, -122.331243552],
 [47.63347746, -122.345942425],
 [47.52011422, -122.355134625],
 [47.64939241, -122.383361499],
 [47.61205117, -122.324549777],
 [47.72919593, -122.32542270799999],
 [47.6841481, -122.37678325],
 [47.63272539, -122.34595052700001],
 [47.56203576, -122.378112262],
 [47.71307948, -122.313996581],
 [47.65296539, -122.357661744],
 [47.63577659, -122.282005215],
 [47.67668862, -122.294062955],
 [47.64650426, -122.32519843799999],
 [47.61375921, -122.347163621],
 [47.62034258, -122.352825467],
 [47.52555707, -122.346740721],
 [47.56203576, -122.378112262],
 [47.54750296, -122.321438931],
 [47.66646689, -122.38475007],
 [47.56203576, -122.378112262],
 [47.52937273, -122.37663737700001],
 [47.61239802, -122.340892454],
 [47.66311774, -122.31742343299999],
 [47.6168222, -122.33746479],
 [47.59178012, -122.301291202],
 [47.62208691, -122.350854024],
 [47.68170464, -122.28839846700001],
 [47.67133528, -122.409492551],
 [47.60898867, -122.33632991700001],
 [47.70598736, -122.35412029999999],
 [47.57449356, -122.289877561],
 [47.64970651, -122.35052537899999],
 [47.6656842, -122.316324693],
 [47.54889699, -122.286264518],
 [47.62262048, -122.337146941],
 [47.6487836, -122.32343616899999],
 [47.61351951, -122.320771381],
 [47.57075994, -122.29101029],
 [47.60166172, -122.299444169],
 [47.52730949, -122.270742451],
 [47.62024125, -122.331700196],
 [47.69764538, -122.316205456],
 [47.54382608, -122.27263623],
 [47.63246376, -122.375834105],
 [47.63225641, -122.324956055],
 [47.65832864, -122.314363316],
 [47.614577600000004, -122.327915389],
 [47.61521815, -122.326804185],
 [47.64537245, -122.36220142799999],
 [47.65415054, -122.357658115],
 [47.66692039, -122.360801329],
 [47.6170232, -122.34574118100001],
 [47.65307548, -122.34533886],
 [47.62797487, -122.36686463299999],
 [47.60951744, -122.338348304],
 [47.60620026, -122.316125608],
 [47.56888116, -122.289921964],
 [47.56834147, -122.366755447],
 [47.60169337, -122.31678189799999],
 [47.5406801, -122.275965432],
 [47.67495519, -122.348475299],
 [47.61222186, -122.34456269399999],
 [47.61523808, -122.32040741700001],
 [47.57259101, -122.385670692],
 [47.62320194, -122.336490221],
 [47.61351951, -122.320771381],
 [47.66222203, -122.319560828],
 [47.59515308, -122.30966889],
 [47.57742324, -122.306707069],
 [47.6303008, -122.32888058],
 [47.65135709, -122.39489671700001],
 [47.65977588, -122.400349386],
 [47.59626534, -122.319220391],
 [47.69061787, -122.359314737],
 [47.62079119, -122.302490423],
 [47.61522188, -122.32500074200001],
 [47.66055372, -122.315461665],
 [47.65046915, -122.35448367],
 [47.55409938, -122.26699284799999],
 [47.61327122, -122.34435339299999],
 [47.55169177, -122.325621124],
 [47.6759485, -122.387584729],
 [47.66426055, -122.382134597],
 [47.59999561, -122.305347166],
 [47.66127317, -122.31370774700001],
 [47.60878866, -122.338449515],
 [47.6621407, -122.353980639],
 [47.66438409, -122.36861026],
 [47.61144442, -122.322461532],
 [47.62151944, -122.355428986],
 [47.67386923, -122.34921452299999],
 [47.66590904, -122.38407773600001],
 [47.60956556, -122.306308505],
 [47.69167434, -122.392944846],
 [47.66222203, -122.319560828],
 [47.66127317, -122.31370774700001],
 [47.71194078, -122.28930893399999],
 [47.7086028, -122.32461515799999],
 [47.68252504, -122.263683194],
 [47.52195143, -122.35511453],
 [47.657916799999995, -122.316665195],
 [47.65659558, -122.317826636],
 [47.68549113, -122.348556109],
 [47.63230108, -122.346263792],
 [47.54442736, -122.390001177],
 [47.66068016, -122.394959875],
 [47.68476424, -122.34314261],
 [47.62369897, -122.320933335],
 [47.6010021, -122.30223583700001],
 [47.62458989, -122.358668576],
 [47.56291163, -122.386775316],
 [47.66332336, -122.298411155],
 [47.60378135, -122.338424085],
 [47.51517049, -122.37327695399999],
 [47.60266908, -122.303083645],
 [47.522661799999995, -122.322978958],
 [47.6106779, -122.33557402299999],
 [47.6506252, -122.350545827],
 [47.62676478, -122.325596007],
 [47.62198537, -122.320415237],
 [47.61316683, -122.342192704],
 [47.53673888, -122.33113442700001],
 [47.68045515, -122.37677179],
 [47.521947999999995, -122.357805911],
 [47.62459539, -122.35997484100001],
 [47.61051065, -122.339256992],
 [47.59918657, -122.318430722],
 [47.61173309, -122.341752608],
 [47.53887651, -122.389423618],
 [47.66794353, -122.336386268],
 [47.65741891, -122.339734034],
 [47.61796543, -122.3503095],
 [47.61173309, -122.341752608],
 [47.54786831, -122.376377224],
 [47.62443829, -122.311319706],
 [47.653149400000004, -122.336891881],
 [47.68592294, -122.32697455],
 [47.71691267, -122.357055968],
 [47.6818033, -122.348140628],
 [47.62256335, -122.322016608],
 [47.62081538, -122.332345086],
 [47.6465158, -122.35054705200001],
 [47.5899869, -122.317744679],
 [47.60878866, -122.338449515],
 [47.53979464, -122.27399864200001],
 [47.64073924, -122.34801104799999],
 [47.56380429, -122.329368515],
 [47.58295413, -122.30166388100001],
 [47.54925505, -122.329580805],
 [47.54267933, -122.298060435],
 [47.61096316, -122.31281927299999],
 [47.6613414, -122.324572069],
 [47.60829217, -122.337995355],
 [47.67844054, -122.32716025200001],
 [47.61027832, -122.339812453],
 [47.59678343, -122.333268209],
 [47.62678118, -122.355383386],
 [47.61210339, -122.333808099],
 [47.68657154, -122.339777827],
 [47.60882096, -122.34001342200001],
 [47.64260983, -122.32463795299999],
 [47.63555139, -122.340449804],
 [47.65908266, -122.31550035],
 [47.55371913, -122.26869601899999],
 [47.62024125, -122.331700196],
 [47.71407537, -122.32876021],
 [47.60602417, -122.34013604],
 [47.61021404, -122.336683423],
 [47.61239802, -122.340892454],
 [47.72640779, -122.355553881],
 [47.565835899999996, -122.402894894],
 [47.60733885, -122.326381982],
 [47.53414405, -122.329758715],
 [47.65984569, -122.28274756],
 [47.61465549, -122.320789514],
 [47.61078997, -122.29883299299999],
 [47.61078997, -122.29883299299999],
 [47.55697692, -122.38689807],
 [47.66221425, -122.31840882200001],
 [47.61351951, -122.320771381],
 [47.63299911, -122.34228237],
 [47.7086028, -122.32461515799999],
 [47.515991799999995, -122.259361646],
 [47.60203767, -122.329191024],
 [47.60217535, -122.307659486],
 [47.66138572, -122.33990953200001],
 [47.60469505, -122.33623842899999],
 [47.66944627, -122.38050518],
 [47.60310245, -122.318101814],
 [47.53696508, -122.26459826],
 [47.61289269, -122.289833519],
 [47.60129045, -122.326352374],
 [47.61206556, -122.341322535],
 [47.67017748, -122.38050834799999],
 [47.62776746, -122.308630228],
 [47.72586925, -122.326212556],
 [47.68777624, -122.333133074],
 [47.66503856, -122.367398557],
 [47.68776532, -122.331029784],
 [47.58868133, -122.384994246],
 [47.67417226, -122.365579525],
 [47.54970791, -122.37231413],
 [47.59749957, -122.317226728],
 [47.54102078, -122.359595869],
 [47.61764314, -122.339844859],
 [47.61748617, -122.336606604],
 [47.56616436, -122.36945052799999],
 [47.53803809, -122.393522869],
 [47.64940239, -122.38975847299999],
 [47.61351951, -122.320771381],
 [47.61337517, -122.34651295100001],
 [47.55059186, -122.312324244],
 [47.61655803, -122.332067369],
 [47.60469505, -122.33623842899999],
 [47.65048622, -122.333281162],
 [47.59031253, -122.335568737],
 [47.56203576, -122.378112262],
 [47.70506663, -122.350438994],
 [47.63434575, -122.346708374],
 [47.54586222, -122.300465341],
 [47.66602881, -122.31842609899999],
 [47.67165303, -122.394264755],
 [47.72321155, -122.344976874],
 [47.64343028, -122.30379808200001],
 [47.62747889, -122.316790825],
 [47.68736239, -122.274140565],
 [47.55059186, -122.312324244],
 [47.59828765, -122.331580821],
 [47.71327157, -122.360878336],
 [47.61711857, -122.33813721899999],
 [47.7086028, -122.32461515799999],
 [47.66212687, -122.336425972],
 [47.693520299999996, -122.362005575],
 [47.61207057, -122.33224407899999],
 [47.56281944, -122.288370356],
 [47.56281944, -122.288370356],
 [47.62024434, -122.33042040299999],
 [47.5586471, -122.28210206899999],
 [47.62635868, -122.353424674],
 [47.69873276, -122.35125516],
 [47.64689712, -122.36073516100001],
 [47.60088279, -122.333852598],
 [47.66400406, -122.31422406],
 [47.60622921, -122.33610794399999],
 [47.69421686, -122.35533949399999],
 [47.69421686, -122.35533949399999],
 [47.630894399999995, -122.36180477399999],
 [47.61382604, -122.33461676299999],
 [47.7086028, -122.32461515799999],
 [47.61432034, -122.344143639],
 [47.69367379, -122.376800685],
 [47.60519799, -122.324423057],
 [47.59123749, -122.29290369799999],
 [47.66789134, -122.376215692],
 [47.63936189, -122.34481514299999],
 [47.57182077, -122.401455744],
 [47.67152891, -122.343686961],
 [47.55029129999999, -122.386360335],
 [47.65125414, -122.38254774200001],
 [47.64254112, -122.38486258200001],
 [47.5970607, -122.30636336399999],
 [47.66219941, -122.317451102],
 [47.62624866, -122.354081443],
 [47.60981959, -122.326346825],
 [47.55286517, -122.37494377899999],
 [47.60214897, -122.334176844],
 [47.64633864, -122.36073931700001],
 [47.72961987, -122.358249806],
 [47.67756433, -122.32391191],
 [47.63812079, -122.394228475],
 [47.60882096, -122.34001342200001],
 [47.60951366, -122.29885022799999],
 [47.663236600000005, -122.353971569],
 [47.59749563, -122.31499334600001],
 [47.6353476, -122.37167213299999],
 [47.52611725, -122.279013428],
 [47.53933802, -122.278067349],
 [47.60683220000001, -122.315466047],
 [47.67017314, -122.377548124],
 [47.69421686, -122.35533949399999],
 [47.56888116, -122.289921964],
 [47.58636268, -122.31336275299999],
 [47.66569311, -122.36739736700001],
 [47.67017143, -122.376213105],
 [47.68086876, -122.318105838],
 [47.66218058, -122.313115709],
 [47.66126195, -122.31199331299999],
 [47.59793449, -122.32636549200001],
 [47.61407001, -122.323401481],
 [47.61163943, -122.334918446],
 [47.51728498, -122.342238437],
 [47.53641053, -122.387306785],
 [47.58085339, -122.335124811],
 [47.54381503, -122.273741067],
 [47.61586644, -122.314251704],
 [47.60922844, -122.31711381299999],
 [47.59918733, -122.320331973],
 [47.66438257, -122.283362769],
 [47.6506252, -122.350545827],
 [47.7086028, -122.32461515799999],
 [47.6506252, -122.350545827],
 [47.67598308, -122.366290818],
 [47.68947337, -122.360648295],
 [47.56397206, -122.37877029399999],
 [47.63740507, -122.347707544],
 [47.49896304, -122.26101785799999],
 [47.69873276, -122.35125516],
 [47.66323339, -122.351475619],
 [47.6169873, -122.320826482],
 [47.62367132, -122.29489427799999],
 [47.72943438, -122.364646459],
 [47.69244514, -122.360001634],
 [47.50731753, -122.378728685],
 [47.60276918, -122.331408526],
 [47.60690257, -122.34133454399999],
 [47.681263799999996, -122.35944629299999],
 [47.68779109, -122.380017781],
 [47.55307106, -122.395030175],
 [47.62196996, -122.33107017399999],
 [47.57981138, -122.33512489299999],
 [47.52196556, -122.376730708],
 [47.66508479, -122.38310615],
 [47.61973228, -122.345656443],
 [47.69288726, -122.30048929700001],
 [47.72503555, -122.34499682799999],
 [47.67668633, -122.276900993],
 [47.61395514, -122.33658468899999],
 [47.61090902, -122.33501787600001],
 [47.61201358, -122.340242172],
 [47.68596821, -122.37678968899999],
 [47.68596821, -122.37678968899999],
 [47.64102318, -122.31070781700001],
 [47.6862023, -122.36065074700001],
 [47.69704501, -122.290544116],
 [47.68015558, -122.324611421],
 [47.63620722, -122.302268438],
 [47.60878866, -122.338449515],
 [47.52849122, -122.38536349799999],
 [47.61135552, -122.320313017],
 [47.65475623, -122.344656988],
 [47.60622905, -122.31024879600001],
 [47.50728081, -122.251208634],
 [47.63750678, -122.325897131],
 [47.61477578, -122.338964332],
 [47.6169873, -122.320826482],
 [47.58610395, -122.335121518],
 [47.68252504, -122.263683194],
 [47.66864556, -122.39507632899999],
 [47.61122962, -122.325334378],
 [47.60241242, -122.331082199],
 [47.60832457, -122.339559369],
 [47.70025321, -122.32578976],
 [47.55305099, -122.330933137],
 [47.54607698, -122.28731645799999],
 [47.62028465, -122.33716576100001],
 [47.57593312, -122.412697629],
 [47.67163093, -122.377546904],
 [47.66899297, -122.311884295],
 [47.6322825, -122.347488629],
 [47.61952437, -122.293491681],
 [47.65835777, -122.361875641],
 [47.54487245, -122.319791691],
 [47.65948109, -122.363992484],
 [47.66595739, -122.382666321],
 [47.61170568, -122.338047718],
 [47.52211381, -122.345449913],
 [47.69782007, -122.348650455],
 [47.50318981, -122.262141935],
 [47.62511902, -122.327245106],
 [47.51654951, -122.378095285],
 [47.63965592, -122.376154128],
 [47.66957786, -122.33210684299999],
 [47.68299248, -122.327909297],
 [47.62371704, -122.324034002],
 [47.61980873, -122.32347145899999],
 [47.51293677, -122.387291152],
 [47.62073726, -122.29119018600001],
 [47.69288726, -122.30048929700001],
 [47.66945596, -122.386164941],
 [47.61173309, -122.341752608],
 [47.53155081, -122.285043308],
 [47.58610377, -122.33419784200001],
 [47.63057253, -122.34624506600001],
 [47.63057253, -122.34624506600001],
 [47.617225, -122.331208693],
 [47.54834584, -122.359799937],
 [47.57981194, -122.336785972],
 [47.55233647, -122.28546570299999],
 [47.67475338, -122.32545473799999],
 [47.66395556, -122.307204506],
 [47.67561847, -122.38758443],
 [47.57020992, -122.299174478],
 [47.61764104, -122.299964116],
 [47.51561012, -122.377978191],
 [47.53764263, -122.270432964],
 [47.61132124, -122.337320423],
 [47.609317600000004, -122.340467725],
 [47.64254854, -122.35555354],
 [47.70928167, -122.327311405],
 [47.68966673, -122.37680278200001],
 [47.64865856, -122.356463031],
 [47.61886279, -122.326726864],
 [47.60898867, -122.33632991700001],
 [47.57876777, -122.329057086],
 [47.657916799999995, -122.316665195],
 [47.65496124, -122.400897858],
 [47.57664991, -122.329058175],
 [47.587407, -122.38629843],
 [47.54053232, -122.32235312700001],
 [47.6296551, -122.32861062200001],
 [47.60214897, -122.334176844],
 [47.61044025, -122.336890505],
 [47.53704403, -122.28234489],
 [47.7031221, -122.320446727],
 [47.59450349, -122.30676185600001],
 [47.6449469, -122.36220636799999],
 [47.59834624, -122.320293271],
 [47.57303502, -122.287210701],
 [47.55838564, -122.36017028100001],
 [47.66504255, -122.37076455299999],
 [47.67780671, -122.372997239],
 [47.64503039, -122.34730244299999],
 [47.64503039, -122.34730244299999],
 [47.66867543, -122.381852063],
 [47.62208691, -122.350854024],
 [47.62457413, -122.35344531],
 [47.6122349, -122.31414739700001],
 [47.56019555, -122.385483507],
 [47.56060208, -122.26754606600001],
 [47.62973253, -122.345580055],
 [47.60684371, -122.320751354],
 [47.66943265, -122.36739025],
 [47.61768872, -122.34488168600001],
 [47.62973253, -122.345580055],
 [47.60774723, -122.333658663],
 [47.60690257, -122.34133454399999],
 [47.62973253, -122.345580055],
 [47.63101874, -122.367809798],
 [47.55838564, -122.36017028100001],
 [47.59519408, -122.30844125],
 [47.66401157, -122.315250735],
 [47.67325779, -122.36186049999999],
 [47.56408887, -122.278253691],
 [47.60805203, -122.327034667],
 [47.65311668, -122.330873403],
 [47.6010021, -122.30223583700001],
 [47.57841911, -122.393088616],
 [47.65311668, -122.330873403],
 [47.563474600000006, -122.377450223],
 [47.66220234, -122.37359542799999],
 [47.62792521, -122.340164663],
 [47.58716618, -122.334197241],
 [47.70313122, -122.32179756200001],
 [47.54106972, -122.343181979],
 [47.61222186, -122.34456269399999],
 [47.62461826, -122.335057541],
 [47.71354798, -122.34483426799999],
 [47.5876874, -122.317277214],
 [47.60278737, -122.33372665799999],
 [47.6136555, -122.345003455],
 [47.54667844, -122.27654799],
 [47.52377874, -122.353959159],
 [47.67954066, -122.372774996],
 [47.6159486, -122.33400670200001],
 [47.66057874, -122.317722691],
 [47.66852575, -122.30061896],
 [47.69036129, -122.267521781],
 [47.63534741, -122.366348559],
 [47.66217279999999, -122.311979511],
 [47.6907698, -122.306858192],
 [47.55061696, -122.258073024],
 [47.68776773, -122.332095474],
 [47.61090902, -122.33501787600001],
 [47.5563782, -122.3642723],
 [47.56563178, -122.364364861],
 [47.56563178, -122.364364861],
 [47.66487705, -122.30967533299999],
 [47.54472315, -122.357154115],
 [47.68125465, -122.36333503200001],
 [47.69418567, -122.34456496700001],
 [47.62597678, -122.321314955],
 [47.63954328, -122.348288096],
 [47.60478099, -122.319411925],
 [47.66332336, -122.298411155],
 [47.66764582, -122.384745436],
 [47.68245283, -122.324874674],
 [47.60088199, -122.33320019700001],
 [47.67123325, -122.28577456200001],
 [47.54657841, -122.320402556],
 [47.6614607, -122.36278640100001],
 [47.66222203, -122.319560828],
 [47.65281337, -122.351287648],
 [47.58716582, -122.333265005],
 [47.66987864, -122.410259546],
 [47.70270884, -122.366062642],
 [47.64494977, -122.361552606],
 [47.61909217, -122.312733013],
 [47.65905499, -122.313187755],
 [47.61201358, -122.340242172],
 [47.60170348, -122.322446855],
 [47.59541565, -122.3250699],
 [47.58716618, -122.334197241],
 [47.61094335, -122.30755406799999],
 [47.60878866, -122.338449515],
 [47.60878866, -122.338449515],
 [47.63077276, -122.29724785799999],
 [47.69431302, -122.279992473],
 [47.63888081, -122.287911853],
 [47.64965141, -122.32276538100001],
 [47.59901514, -122.313926471],
 [47.61467441, -122.318150199],
 [47.66129196, -122.316578939],
 [47.53705079, -122.28006028700001],
 [47.66748414, -122.31189877899999],
 [47.60046424, -122.330807495],
 [47.68776532, -122.331029784],
 [47.56646382, -122.372917421],
 [47.60241242, -122.331082199],
 [47.60241242, -122.331082199],
 [47.521028799999996, -122.36050810399999],
 [47.62501526, -122.355400414],
 [47.60126323, -122.298924267],
 [47.66357398, -122.31955133],
 [47.54195105, -122.376509787],
 [47.69056669, -122.34586451700001],
 [47.62034258, -122.352825467],
 [47.65905498, -122.31318776100001],
 [47.62137325, -122.36065193299999],
 [47.69418264, -122.344027064],
 [47.68621775, -122.35120611],
 [47.52103664, -122.369349379],
 [47.61465549, -122.320789514],
 [47.60878866, -122.338449515],
 [47.7086028, -122.32461515799999],
 [47.51655904, -122.383451722],
 [47.51655904, -122.383451722],
 [47.66365981, -122.37218016],
 [47.56668347, -122.29415562700001],
 [47.57876967, -122.335125901],
 [47.63802564, -122.27710074299999],
 [47.61351259, -122.319440734],
 [47.56652333, -122.370781263],
 [47.60794735, -122.319031216],
 [47.56955142, -122.407487895],
 [47.69698014, -122.37679400299999],
 [47.66358876, -122.359825925],
 [47.60981273, -122.342879598],
 [47.68236016, -122.397057159],
 [47.5231392, -122.345463815],
 [47.5231392, -122.345463815],
 [47.61635384, -122.351549852],
 [47.59678343, -122.333268209],
 [47.5231392, -122.345463815],
 [47.68213816, -122.30396781299999],
 [47.62375649, -122.31261506],
 [47.62253997, -122.316763886],
 [47.55602579, -122.30451113299999],
 [47.69706855, -122.340798812],
 [47.68966673, -122.37680278200001],
 [47.65162002, -122.34262684299999],
 [47.60849931, -122.294920997],
 [47.67161721, -122.31566268200001],
 [47.60779562, -122.337541071],
 [47.61201358, -122.340242172],
 [47.60518283, -122.29492011],
 [47.642067499999996, -122.317179758],
 [47.61018166, -122.335119804],
 [47.49896304, -122.26101785799999],
 [47.57508408, -122.300628005],
 [47.61774596, -122.324504955],
 [47.62324273, -122.34758256100001],
 [47.72961502, -122.356905456],
 [47.6140898, -122.31879387],
 [47.60910568, -122.32569436],
 [47.54598711, -122.32192876299999],
 [47.65073869, -122.351298525],
 [47.57733075, -122.296206859],
 [47.66523531, -122.380436318],
 [47.59506342, -122.299060451],
 [47.62392112, -122.354103757],
 [47.66310579, -122.315262725],
 [47.5947223, -122.31198469200001],
 [47.51973681, -122.287181481],
 [47.60619596, -122.33147209799999],
 [47.68591024, -122.264216755],
 [47.65245059, -122.39040072],
 [47.670551700000004, -122.387587333],
 [47.58843679, -122.31542020399999],
 [47.5947223, -122.31198469200001],
 [47.66358802, -122.35002297700001],
 [47.66827034, -122.395374511],
 [47.5992282, -122.310924822],
 [47.69224997, -122.360660632],
 [47.60833603, -122.333430335],
 [47.52559207, -122.31492387899999],
 [47.61909217, -122.312733013],
 [47.60241242, -122.331082199],
 [47.60171616, -122.33026479],
 [47.59927753, -122.30051057899999],
 [47.59924291, -122.308315131],
 [47.5824281, -122.31470299600001],
 [47.59678343, -122.333268209],
 [47.66138373, -122.33313323899999],
 [47.64410503, -122.350662371],
 [47.65212542, -122.353942889],
 [47.56562936, -122.386771446],
 [47.71052598, -122.35416468],
 [47.70858578, -122.321918379],
 [47.56888116, -122.289921964],
 [47.63811678, -122.304228312],
 [47.7123018, -122.33809037],
 [47.72503036, -122.334864925],
 [47.68691723, -122.335985674],
 [47.65878493, -122.28139141700001],
 [47.61537831, -122.31065879799999],
 [47.61090902, -122.33501787600001],
 [47.60003505, -122.328314208],
 [47.6721403, -122.354383099],
 [47.66394943, -122.35396688],
 [47.60458687, -122.33767486299999],
 [47.56558496, -122.380088515],
 [47.69605174, -122.36269117],
 [47.652599, -122.35604503799999],
 [47.57422938, -122.32093822899999],
 [47.66553047, -122.354432771],
 [47.56179614, -122.288819395],
 [47.54706873, -122.28594737200001],
 [47.60832457, -122.339559369],
 [47.59877133, -122.325056926],
 [47.54488015, -122.29689067700001],
 [47.64829623, -122.332493897],
 [47.66365138, -122.365095114],
 [47.66395556, -122.307204506],
 [47.57067373, -122.288272089],
 [47.66590904, -122.38407773600001],
 [47.56401579, -122.301679152],
 [47.52556673, -122.34801499299999],
 [47.70579555, -122.346046913],
 [47.51045606, -122.278612078],
 [47.60392934, -122.311255074],
 [47.60709272, -122.307629047],
 [47.65245059, -122.39040072],
 [47.61465314, -122.326812324],
 [47.6538631, -122.371539267],
 [47.65309155, -122.391186601],
 [47.69061787, -122.359314737],
 [47.61581012, -122.322139361],
 [47.59919954, -122.315680055],
 [47.69512229, -122.355348867],
 [47.7086028, -122.32461515799999],
 [47.66426055, -122.382134597],
 [47.67644095, -122.346604951],
 [47.666424600000006, -122.369685449],
 [47.6225886, -122.297502342],
 [47.70290617, -122.35408479799999],
 [47.61156267, -122.316778894],
 [47.54925505, -122.329580805],
 [47.67310479, -122.388862944],
 [47.61774908, -122.32397670600001],
 [47.61173309, -122.341752608],
 [47.66523531, -122.380436318],
 [47.57039471, -122.314756288],
 [47.53314344, -122.26998690299999],
 [47.708492799999995, -122.277281286],
 [47.6262637, -122.360616874],
 [47.65832864, -122.314363316],
 [47.66407381, -122.3250673],
 [47.55196129, -122.376307087],
 [47.60494346, -122.338001049],
 [47.65957993, -122.325133579],
 [47.61351259, -122.319440734],
 [47.66021064, -122.325124365],
 [47.614099100000004, -122.31748840799999],
 [47.61470207, -122.31423321],
 [47.66365981, -122.372180162],
 [47.72506164, -122.35792485700001],
 [47.66568132, -122.31522862799999],
 [47.70294273, -122.360747075],
 [47.5556806, -122.397091588],
 [47.65908266, -122.31550035],
 [47.7086028, -122.32461515799999],
 [47.60412808, -122.32344394],
 [47.68591024, -122.264216755],
 [47.5403814, -122.37124287200001],
 [47.59557258, -122.30116915],
 [47.57952399, -122.28571859600001],
 [47.57738881, -122.31045258700001],
 [47.55491458, -122.35478087899999],
 [47.58031251, -122.395328326],
 [47.60130276, -122.33418005200001],
 [47.61679884, -122.349327376],
 [47.61170568, -122.338047719],
 [47.57221261, -122.35259747100001],
 [47.53521435, -122.279354565],
 [47.73213862, -122.314070854],
 [47.61472125, -122.300091132],
 [47.67956073, -122.359961681],
 [47.62198179, -122.326872991],
 [47.56744279, -122.36329652],
 [47.65292347, -122.339335776],
 [47.69853101, -122.343967584],
 [47.59664771, -122.31028093799999],
 [47.701792100000006, -122.344655369],
 [47.701792100000006, -122.344655369],
 [47.61352655, -122.322102205],
 [47.61538897, -122.337024723],
 [47.62392989, -122.356714535],
 [47.63841488, -122.38916000200001],
 [47.59708197, -122.319640739],
 [47.59928482, -122.301685333],
 [47.66146817, -122.369692489],
 [47.62648333, -122.339128441],
 [47.68658392, -122.34450137399999],
 [47.61644612, -122.314914139],
 [47.5403814, -122.37124287200001],
 [47.69418264, -122.344027064],
 [47.66179829, -122.355436223],
 [47.62721548, -122.35016108399999],
 [47.65733179, -122.33260473600001],
 [47.68591024, -122.264216755],
 [47.682344, -122.37150300100001],
 [47.62957979, -122.322319735],
 [47.68252504, -122.263683194],
 [47.62394441, -122.360633329],
 [47.63057253, -122.34624506600001],
 [47.62460297, -122.361933981],
 [47.65703556, -122.35758014],
 [47.61294138, -122.302063749],
 [47.63141024, -122.346267302],
 [47.62022447, -122.326575529],
 [47.60829217, -122.337995355],
 [47.60578655, -122.324195215],
 [47.62673967, -122.352774412],
 [47.61581012, -122.322139361],
 [47.68591024, -122.264216755],
 [47.66944418, -122.377548728],
 [47.64846567, -122.37818565299999],
 [47.68252504, -122.263683194],
 [47.56888116, -122.289921964],
 [47.68252504, -122.263683194],
 [47.61778341, -122.327864009],
 [47.61934309, -122.318224655],
 [47.55446456, -122.28616159999999],
 [47.61221899, -122.308863594],
 [47.70856098, -122.317852211],
 [47.525586, -122.350563897],
 [47.70780643, -122.35547359200001],
 [47.53685595, -122.344504911],
 [47.59919591, -122.32831725],
 [47.66489247, -122.27439345299999],
 [47.64752222, -122.381977746],
 [47.6267157, -122.34624836299999],
 [47.59919954, -122.315680055],
 [47.6100189, -122.34282172700001],
 [47.59919954, -122.315680055],
 [47.65316235, -122.387930308],
 [47.72048199, -122.344946826],
 [47.62254749, -122.33043185700001],
 [47.52281565, -122.26998788],
 [47.67089179, -122.367385947],
 [47.51107441, -122.385813148],
 [47.66903527, -122.361858361],
 [47.67034534, -122.3141656],
 [47.69057898, -122.34991193200001],
 [47.67309753, -122.382130373],
 [47.52698191, -122.35507042799999],
 [47.52698191, -122.35507042799999],
 [47.6721505, -122.29689595],
 [47.6656429, -122.30946412899999],
 [47.53100159, -122.35277559],
 [47.67017143, -122.376213105],
 [47.66905294, -122.303946113],
 [47.664292700000004, -122.345298846],
 [47.55344408, -122.28758646600001],
 [47.52643322, -122.34165274700001],
 [47.66022054, -122.353852136],
 [47.56783713, -122.374045411],
 [47.55344408, -122.28758646600001],
 [47.56884139, -122.374026552],
 [47.56884139, -122.374026552],
 [47.6818033, -122.348140628],
 [47.62832451, -122.327099922],
 [47.60218266, -122.312875515],
 [47.63498835, -122.34228517700001],
 [47.58872351, -122.29358695],
 [47.66878893, -122.28079986],
 [47.66311774, -122.31742343299999],
 [47.62388673, -122.342355426],
 [47.66314071, -122.320715614],
 [47.607080200000006, -122.29364884200001],
 [47.62031402, -122.345007223],
 [47.67126428, -122.373581435],
 [47.53097632, -122.360446432],
 [47.72503555, -122.34499682799999],
 [47.52281565, -122.26998788],
 [47.58499648, -122.301629329],
 [47.60484128, -122.324096855],
 [47.71957221, -122.344936817],
 [47.52431706, -122.314946259],
 [47.53736411, -122.38851250299999],
 [47.52389209, -122.31495329399999],
 [47.53379271, -122.280824737],
 [47.66365981, -122.37218016],
 [47.7108808, -122.32601409999998],
 [47.61210339, -122.333808099],
 ...]
In [105]:
(heatPlot['Year Start']).unique()
Out[105]:
array([2020, 2019, 2016, 2007, 2018, 2015, 2014, 2017, 2013, 2009, 2010,
       2004, 1987, 2011, 2012, 2006, 2008, 1999, 2003, 1929, 1993, 2002,
       2005, 1995, 1991, 2001, 2000, 1998, 1997, 1994, 1996, 1980, 1992,
       1915, 1953, 1989], dtype=object)
In [106]:
(heatPlot['Crime Against Category']).unique()
Out[106]:
array(['PROPERTY', 'SOCIETY', 'PERSON'], dtype=object)
In [107]:
(heatPlot['Offense']).unique()
Out[107]:
array(['Theft of Motor Vehicle Parts or Accessories', 'Robbery',
       'Destruction/Damage/Vandalism of Property',
       'Theft From Motor Vehicle', 'Wire Fraud', 'Counterfeiting/Forgery',
       'Drug/Narcotic Violations', 'All Other Larceny',
       'Pornography/Obscene Material', 'Extortion/Blackmail',
       'Shoplifting', 'Motor Vehicle Theft', 'Theft From Building',
       'Driving Under the Influence', 'Stolen Property Offenses',
       'Credit Card/Automated Teller Machine Fraud', 'Identity Theft',
       'False Pretenses/Swindle/Confidence Game', 'Impersonation',
       'Weapon Law Violations', 'Hacking/Computer Invasion',
       'Embezzlement', 'Bad Checks', 'Pocket-picking',
       'Drug Equipment Violations', 'Purchasing Prostitution',
       'Purse-snatching', 'Theft From Coin-Operated Machine or Device',
       'Liquor Law Violations', 'Arson',
       'Curfew/Loitering/Vagrancy Violations', 'Prostitution',
       'Assisting or Promoting Prostitution', 'Drunkenness',
       'Animal Cruelty', 'Welfare Fraud',
       'Operating/Promoting/Assisting Gambling', 'Bribery',
       'Betting/Wagering', 'Gambling Equipment Violation',
       'Trespass of Real Property', 'Aggravated Assault',
       'Simple Assault', 'Burglary/Breaking & Entering', 'Intimidation'],
      dtype=object)
In [108]:
#('LARCENY-THEFT', 220201),('BURGLARY/BREAKING&ENTERING', 62254),('MOTOR VEHICLE THEFT', 45195),('DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY', 42639),('FRAUD OFFENSES', 35439)]
def isPopularOffense(offense):
    if offense == 'LARCENY-THEFT':
        return 'white'
    elif offense == 'BURGLARY/BREAKING & ENTERING':
        return 'red'
    elif offense == 'MOTOR VEHICLE THEFT':
        return 'blue'
    elif offense == 'DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY':
        return 'yellow'
    elif offense == 'FRAUD OFFENSES':
        return 'green'
In [109]:
heatPlotIT=heatPlot[0:3000]
heatPlotIT
Out[109]:
Crime Against Category Offense Parent Group Offense Longitude Latitude Year Start Month of OCCURENCE
1 PROPERTY LARCENY-THEFT Theft of Motor Vehicle Parts or Accessories -122.323399 47.675118 2020 February
2 PROPERTY ROBBERY Robbery -122.299552 47.666384 2020 February
3 PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property -122.384865 47.642927 2020 February
7 PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property -122.355309 47.680527 2020 February
9 PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property -122.304891 47.697564 2020 February
... ... ... ... ... ... ... ...
4065 PROPERTY LARCENY-THEFT Theft From Motor Vehicle -122.327276 47.659594 2019 December
4066 PROPERTY LARCENY-THEFT Theft From Motor Vehicle -122.267197 47.534895 2019 December
4067 PROPERTY LARCENY-THEFT Theft From Motor Vehicle -122.355434 47.703272 2019 December
4068 PROPERTY DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY Destruction/Damage/Vandalism of Property -122.350005 47.658196 2019 December
4069 PROPERTY LARCENY-THEFT All Other Larceny -122.282696 47.696335 2019 December

3000 rows × 7 columns

In [110]:
count_LARCENY_THEFT=0 
count_BURGLARY_BREAKING_and_ENTERING=0 
count_MOTOR_VEHICLE_THEFT=0 
count_DESTRUCTION_DAMAGE_VANDALISM_OF_PROPERTY=0 
count_FRAUD_OFFENSES=0 


for point in heatPlotIT.index:
    if heatPlotIT.loc[point]['Offense Parent Group']=='LARCENY-THEFT':
        count_LARCENY_THEFT+=1
    elif heatPlotIT.loc[point]['Offense Parent Group']=='BURGLARY/BREAKING&ENTERING':
        count_BURGLARY_BREAKING_and_ENTERING+=1
    elif heatPlotIT.loc[point]['Offense Parent Group']=='MOTOR VEHICLE THEFT':
        count_MOTOR_VEHICLE_THEFT+=1
    elif heatPlotIT.loc[point]['Offense Parent Group']=='DESTRUCTION/DAMAGE/VANDALISM OF PROPERTY':
        count_DESTRUCTION_DAMAGE_VANDALISM_OF_PROPERTY+=1
    elif heatPlotIT.loc[point]['Offense Parent Group']=='FRAUD OFFENSES':
        count_FRAUD_OFFENSES+=1

    map_parentGroup.add_child(folium.CircleMarker(location=locationsCrimeList[point], fill='true',radius = 6,popup= 'Hi', fill_color=isPopularOffense(heatPlotIT.loc[point]['Offense Parent Group']),color = 'clear',fill_opacity=1))


map_parentGroup
Out[110]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [111]:
def isCrimeAgainst(group):
    if group == 'PROPERTY':
        return 'red'
    elif group == 'SOCIETY':
        return 'green'
    elif group == 'PERSON':
        return 'blue'
    elif group == 'NOT_A_CRIME':
        return 'white'
  
In [112]:
count_PROPERTY=0 
count_SOCIETY=0 
count_PERSON=0 
count_NotACrime=0 


for point in heatPlotIT.index:
    if heatPlotIT.loc[point]['Crime Against Category']=='PROPERTY':
        count_PROPERTY+=1
    elif heatPlotIT.loc[point]['Crime Against Category']=='SOCIETY':
        count_SOCIETY+=1
    elif heatPlotIT.loc[point]['Crime Against Category']=='PERSON':
        count_PERSON+=1
    elif heatPlotIT.loc[point]['Crime Against Category']=='NOT_A_CRIME':
        count_NotACrime+=1


    map_crimeAgainst.add_child(folium.CircleMarker(location=locationsCrimeList[point], fill='true',radius = 6,popup= 'Hi', fill_color=isCrimeAgainst(heatPlotIT.loc[point]['Crime Against Category']),color = 'clear',fill_opacity=1))


map_crimeAgainst
Out[112]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [ ]:
 
In [ ]: